package models

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
)

var Ctx = context.Background()
var Rdb *redis.Client

func ExampleClient() {
	Rdb = redis.NewClient(&redis.Options{
		Addr:     "14.103.158.217:6379",
		Password: "redis_x3jTtC", // no password set
		DB:       0,              // use default DB
	})

	err := Rdb.Set(Ctx, "key", "value", 0).Err()
	if err != nil {
		panic(err)
	}
	fmt.Println("redis链接成功")
}
